#pragma once
#include "d3dutil.h"
#include "LevelElement.h"
#include "Vertex.h"
#include <vector>
#include "triangle.h"
#include "Skydome.h"

class NxActor;

class Clouds : public LevelElement
{
public:

	struct BoundinBox {
		D3DXVECTOR3 Min;
		D3DXVECTOR3 Max;
	};
	Clouds(Level *pLevel);
	/*
	* Destroys the Clouds object.
	*/
	virtual ~Clouds(void);

	virtual void Initialize(ContentManager *pContentManager);
	virtual void Tick(const InputState & refInputState);
	virtual void Draw(const RenderContext* pRenderContext){}
	void Draw(const RenderContext* pRenderContext, Skydome::ScatteringInfo scatterinfo);
	virtual void DrawRefraction(const RenderContext* pRenderContext, D3DXPLANE refractionplane){}
	virtual void DrawReflection(const RenderContext* pRenderContext, D3DXMATRIX reflectionviewmatrix, D3DXPLANE reflectionplane);
	virtual void DrawShadowMap(const RenderContext* pRenderContext){}

private:
	void CreateEffect(ContentManager *pContentManager);
	void GetEffectVariables(ID3D10Effect* pEffect);
	void BuildVertexBuffer();
	void BuildIndexBuffer();

	void DefineInputlayout();
	void CreatePlanes();

	ID3D10InputLayout*			m_pVertexLayout;
	ID3D10Buffer*				m_pVertexBuffer;
	ID3D10Buffer*				m_pIndexBuffer;
	ID3D10Effect*				m_pDefaultEffect;
	ID3D10EffectTechnique*		m_pDefaultTechnique;
	//Textures

	ID3D10ShaderResourceView *	m_pSpiteSheetTexture;

	//Shader resources for textures

	ID3D10EffectMatrixVariable* m_pWorldVariable;
	ID3D10EffectMatrixVariable* m_pWVPVariable;
	ID3D10EffectVectorVariable* m_pSunColorVariable;
	ID3D10EffectVectorVariable* m_pEyePosVariable;
	ID3D10EffectShaderResourceVariable* m_pSpriteSheetVariable;

	vector<VertexCloud> m_VecVertices;
	vector<DWORD> m_VecIndices;

	D3DXMATRIX m_ReflectionViewMatrix;
	bool m_bReflection;

	int m_NumParticles;
	
	BoundinBox m_BoundingBox;
	// -------------------------
	// Disabling default copy constructor and default assignment operator.
	// If you get a linker error from one of these functions, your class is internally trying to use them. This is
	// an error in your class, these declarations are deliberately made without implementation because they should never be used.
	// -------------------------
	Clouds(const Clouds& t);
	Clouds& operator=(const Clouds& t);
};
